home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / MPW Related / DTS MPW Goodies / MountServer < prev    next >
Encoding:
Text File  |  1990-09-14  |  1.8 KB  |  82 lines  |  [TEXT/MPS ]

  1. #
  2. #    File:        MountServer
  3. #
  4. #    Contains:    script to mount a server
  5. #
  6. #    Usage:        MountServer [[zone:]server]:[volume][:]
  7. #
  8. #    Status:        MountServer may return the following status values:
  9. #
  10. #                    0        the server was mounted
  11. #                    1        error
  12. #                    2        the user canceled
  13. #
  14. #                MountServer mounts a a server volume. If the volume is not already mounted,
  15. #                it asks for a password for the volume.
  16. #
  17. #    Written by:    Darin Adler and scott douglass
  18. #
  19. #    Copyright:    © 1988, 1989 by Apple Computer, Inc., all rights reserved.
  20. #
  21. #    Change History:
  22. #
  23. #        11/9/89        dba        twiddle relentlessly
  24. #
  25. #    To Do:
  26. #
  27.  
  28. Set Exit 0
  29.  
  30. # the following helps to debug until MPW sends echos to Dev:Console instead of Dev:StdErr
  31.  
  32. If {Echo}
  33.     Set somewhere "∑∑ '{Worksheet}'"
  34. Else
  35.     Set somewhere "∑ Dev:Null"
  36. End
  37.  
  38. Begin
  39.  
  40.     Set Server "{1}"
  41.     Set ChooseErrors "{SystemFolder}ChooseErrors"
  42.  
  43.     # make sure that names are formed properly
  44.  
  45.     If "{Server}" =~ /([¬:]*)®2:([¬:]+)®3:«0,1»/
  46.         Set Zone ""
  47.         Set Server "{®2}"
  48.         Set Volume "{®3}"
  49.     Else If "{Server}" =~ /([¬:]*)®1:([¬:]+)®2:([¬:]+)®3:«0,1»/
  50.         Set Zone "{®1}"
  51.         Set Server "{®2}"
  52.         Set Volume "{®3}"
  53.     Else
  54.         Alert "Can’t parse server name: “{Server}”"
  55.         Exit 1
  56.     End
  57.  
  58.     # check if the volume is mounted
  59.  
  60.     If `Exists "{Volume}:"`"" == ""
  61.         # handle case where one volume from this server is already mounted (or empty password)
  62.         Choose "{Zone}:{Server}:{Volume}" ≥ Dev:Null
  63.         If {Status} ≠ 0
  64.             Set IgnoreCmdPeriod 1
  65.             Set Password "`CoolRequest -h -p "Enter your password on the “{Server}” server, please:"; Set GetPasswordStatus {Status}`"
  66.             Set IgnoreCmdPeriod 0
  67.             Exit 2 If {GetPasswordStatus}
  68.     
  69.             Choose "{Zone}:{Server}:{Volume}" -pw "{Password}" ∑ "{ChooseErrors}"
  70.             Set ChooseStatus {Status}
  71.             Unset Password
  72.             If {ChooseStatus} ≠ 0
  73.                 Alert "`Catenate "{ChooseErrors}"`"
  74.                 Delete -i "{ChooseErrors}"
  75.                 Exit 1
  76.             End
  77.             Delete -i "{ChooseErrors}"
  78.         End
  79.     End
  80.  
  81. End {somewhere}
  82.